<%@page import="java.rmi.RemoteException"%>
<%@page import="java.util.Date"%>
<%@page import="com.sun.corba.se.impl.javax.rmi.CORBA.Util"%>
<%@page import="javax.xml.ws.Response"%>
<%@page import="com.sun.corba.se.spi.protocol.RequestDispatcherDefault"%>
<%@page import="exception.NotRegisteredException"%>
<%@page import="java.rmi.Naming"%>
<%@page import="server.ForumHandlerInt"%>
<%@ page contentType="text/html; charset=utf-8" language="java"
	import="java.sql.*" errorPage=""%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<!-- initialize class parameters -->






<html xmlns="http://www.w3.org/1999/xhtml">
<head>


<!-- script for validating forms fields are all filled -->
<script type="text/javascript">
function validate_form ( )
{
    valid = true;

    if ( document.loginForm.userName.value == "" )
    {
        alert ( "Please fill in the 'user_name' box." );
        valid = false;
        return valid;
    }
    
    
    if ( document.loginForm.password.value == "" )
    {
        alert ( "Please fill in the 'password' box." );
        valid = false;
        return valid;
    }
    var responseTxt = loadXMLDoc();
    
    if (responseTxt == "false")
    	return false;
    
    var result = eval(responseTxt);
    //alert("|"+result+"|");
    //alert("|ok|");
    if(result != "ok")
    {
    	//alert("aaaa");
    	document.getElementById("myDiv").innerHTML="<h2>"+result+"</h2>";
    	return false;
    }
    
  //  alert(result);
   //  alert(flag);
    
  
    return valid;
}
</script>



<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
 <link href="styles.css" rel="stylesheet" type="text/css">
    <link href="tableDesign.css" rel="stylesheet" type="text/css">
    <script language="JavaScript" type="text/JavaScript">
		<!--
		function MM_preloadImages() { //v3.0
		  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
			var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
			if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
		}
		-->
	</script>
</head>
<body id="body" link="#6C8EBD">
<div id="main"> 
	<div id="header">
		<div id="logo"><img src="Images/logo1.jpg" alt="logo" width="490" height="182"></div>
		<div id="picture"><img src="Images/logo2.jpg" alt="pic" width="289" height="156"></div>
	</div>
	<div id="line"><img src="Images/line.jpg" alt="line" width="779" height="4"></div>
    <div id="navigation">
		LOGGIN SCREEN
	</div>
	<div id="line2"><img src="Images/line.jpg" alt="line" width="779" height="4"></div>
	<div id="text" ice:editable="*">
		<div id="text2">
			<div class="contentTXT" id="text2txt">
			  	<script type="text/javascript">
function loadXMLDoc()
{
	
var xmlhttp;
var params;
params = "userName="+document.loginForm.userName.value+"&password="+document.loginForm.password.value;
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }

  
xmlhttp.open("POST","userValidation.jsp",false);
//http.open("POST", "userValidation.jsp", true);

//Send the proper header information along with the request
xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlhttp.setRequestHeader("Content-length", params.length);
xmlhttp.setRequestHeader("Connection", "close");


xmlhttp.send(params);


if (xmlhttp.status != 200)
	{
		document.write(xmlhttp.responseText);
		return "false"
	}
	


return xmlhttp.responseText;
}
</script>

	<div id="myDiv"></div>
	<form action="frames.jsp" method="post" name="loginForm"
		onsubmit="return validate_form ( );">
				<table width="200" border="0">
					<tr>
						<th scope="row">username</th>
						<td><input name="userName" type="text" value="" />
						</td>
					</tr>
					<tr>
						<th scope="row">password</th>
						<td><input name="password" type="password" value="" />
						</td>
					</tr>
					<tr>
				</table>
				<input name="login" type="submit" value="login" /> <input
					name="cancle" type="button" value="cancle"
					onclick="window.open('index.jsp', '_self')" />
			</form>
			</div>
		</div>
	</div>
<div id="Num"><img src="Images/line.jpg" alt="line" width="779" height="4"></div>
<div id="footer">
<div class="footerTXT" id="footertxt"><a class="footerTXT">Designed by ariel nir yuri gilad itzhaki and marina</a> </div>   </div>
</div>
</div>
</body>
</html>